#include <stdio.h>

int main()
{
    int a, b, c;
    scanf("%1d%1d%1d", &a, &b, &c);
    printf("%d%d%d\n", c, b, a);

    int d, e, f, g;
    scanf("%d", &d);
    e = d / 100;
    f = (d % 100) / 10;
    g = d % 10;
    printf("%d%d%d\n", g, f, e);

    return 0;
}